<script type="text/javascript" src="{$smarty.const.URL_FULL}modules/requestmodule/js/request_manager.js"></script>

<div id="abpv_loadingDiv">
	<img src="{$smarty.const.THEME_RELATIVE}modules/calendarmodule/images/loading.gif">
</div>

<h1>{$_TR.request_manager_title}</h1>
	<table id="RequestManager" toolbar="#toolbar" singleSelect="true"></table>
	
	<div id="toolbar">
		<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="__AB_RequestManager_CancelRequest('RequestManager')">{$_TR.cancel_request}</a>
		{permissions level=$smarty.const.UILEVEL_PERMISSIONS}
			{if $permissions.manage == 1 || $permissions.approve == 1 || $permissions.administrate == 1}
				{if $permissions.delete == 1 || $permissions.administrate == 1}
				<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="__AB_RequestManager_DeleteEvent('RequestManager')">{$_TR.delete_request}</a>
				{/if}
				{if $permissions.approve == 1 || $permissions.administrate == 1}
					<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-ok" plain="true" onclick="__AB_RequestManager_Approve('RequestManager')">{$_TR.approve_request}</a>
				{/if}
				{if $permissions.add_calendar == 1 || $permissions.administrate == 1}
					<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-view" plain="true" onclick="__AB_RequestManager_AddCalendar('RequestManager')">{$_TR.add_calendar}</a>
				{/if}
			{/if}
		{/permissions}
		
	</div>

{* Dialog for approve *}
<div id="dialog_Approve" icon="icon-ok" style="padding: 10px;">
	<div class="control">
		<label>
			<span class="label">{$_TR.approve_state}</span>
			<select id="dialog_approve_select">
				<option value=0>{$_TR.approve_state0}</option>
				<option value=1>{$_TR.approve_state1}</option>
				<option value=2>{$_TR.approve_state2}</option>
			</select>
		</label>
	</div>
	<div class="control">
		<label>
			<span class="label">{$_TR.approve_reason}</span>
			<textarea id="approve_reason" cols="17" rows="3" name='approve_reason'></textarea>
		</label>
	</div>
</div>
	
	<script>
		var link_url='{$smarty.const.URL_FULL}index.php?module=requestmodule&action=request_getjson&src={$__loc->src}&ajax_action=1';
		var permission_approve={$permission_approve};
		var permission_add_calendar={$permission_add_calendar};
		var lang_dialog_approve_title='{$_TR.approve_dialog}';
		var lang_approve_state0='{$_TR.approve_state0}';
		var lang_approve_state1='{$_TR.approve_state1}';
		var lang_approve_state2='{$_TR.approve_state2}';
		
		{literal}
		$(function(){
			__AB_PDoremi_RequestManager_SetDefaultSource({/literal}'{$__loc->src}'{literal})
			__AB_PDoremi_RequestManager_Init("RequestManager");
		});
	</script>
{/literal}